package com.zengde.ai_sandbox.test.testthread.mathteacher;

public class DriverByLambda {

    public static void main(String[] args) {
         MathTeacher mathTeacher=new MathTeacher();

         //2个加线程
         for(int i=0;i<2;i++){
             new Thread(mathTeacher::add).start();
         }

         //2个减线程
         /* for(int i=0;i<2;i++){
             new Thread(()->{
                 mathTeacher.sub();
             }).start();
         }*/

        for(int i=0;i<2;i++){
            new Thread(mathTeacher::sub).start();
        }




        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
